package com.lock;

import org.openjdk.jol.info.ClassLayout;

/**
 * @author: csh
 * @Date: 2021/5/11 11:16
 * @Description:偏向锁
 */
public class PartialLock {

    static PartialLock partialLock =  new PartialLock();

    public static void main(String[] args) throws InterruptedException {
        Thread.sleep(5000);
        System.out.println("未锁"+ClassLayout.parseInstance(partialLock).toPrintable());
        synchronized (partialLock) {
            System.out.println("加锁"+ClassLayout.parseInstance(partialLock).toPrintable());
        }
    }
}
